package com.youyi.yyviewsdklibrary.Dialog.impl;

import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.youyi.yyviewsdklibrary.Dialog.animator.PopupAnimator;
import com.youyi.yyviewsdklibrary.Dialog.animator.TranslateAnimator;
import com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView;
import com.youyi.yyviewsdklibrary.Dialog.enums.PopupAnimation;
import com.youyi.yyviewsdklibrary.Dialog.util.XPopupUtils;
import com.lkx.liandianqinew.R;

public class FullScreenPopupView extends BasePopupView {
    public ArgbEvaluator argbEvaluator = new ArgbEvaluator();
    protected View contentView;
    int currColor = 0;
    protected FrameLayout fullPopupContainer = ((FrameLayout) findViewById(R.id.fullPopupContainer));
    private Paint paint = new Paint();
    protected Rect shadowRect;
    private TranslateAnimator translateAnimator;

    public FullScreenPopupView(Context context) {
        super(context);
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public int getInnerLayoutId() {
        return R.layout._xpopup_fullscreen_popup_view;
    }

    /* access modifiers changed from: protected */
    public void addInnerContent() {
        View inflate = LayoutInflater.from(getContext()).inflate(getImplLayoutId(), (ViewGroup) this.fullPopupContainer, false);
        this.contentView = inflate;
        this.fullPopupContainer.addView(inflate);
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void initPopupContent() {
        super.initPopupContent();
        if (this.fullPopupContainer.getChildCount() == 0) {
            addInnerContent();
        }
        getPopupContentView().setTranslationX((float) this.popupInfo.offsetX);
        getPopupContentView().setTranslationY((float) this.popupInfo.offsetY);
    }

    /* access modifiers changed from: protected */
    public void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        if (this.popupInfo != null && this.popupInfo.hasStatusBarShadow.booleanValue()) {
            this.paint.setColor(this.currColor);
            Rect rect = new Rect(0, 0, getMeasuredWidth(), XPopupUtils.getStatusBarHeight());
            this.shadowRect = rect;
            canvas.drawRect(rect, this.paint);
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void doShowAnimation() {
        super.doShowAnimation();
        doStatusBarColorTransform(true);
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void doDismissAnimation() {
        super.doDismissAnimation();
        doStatusBarColorTransform(false);
    }

    private void doStatusBarColorTransform(boolean z) {
        int i;
        if (this.popupInfo != null && this.popupInfo.hasStatusBarShadow.booleanValue()) {
            ArgbEvaluator argbEvaluator2 = this.argbEvaluator;
            Object[] objArr = new Object[2];
            int i2 = 0;
            if (z) {
                i = 0;
            } else {
                i = getStatusBarBgColor();
            }
            objArr[0] = Integer.valueOf(i);
            if (z) {
                i2 = getStatusBarBgColor();
            }
            objArr[1] = Integer.valueOf(i2);
            ValueAnimator ofObject = ValueAnimator.ofObject(argbEvaluator2, objArr);
            ofObject.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                /* class com.youyi.yyviewsdklibrary.Dialog.impl.FullScreenPopupView.AnonymousClass1 */

                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    FullScreenPopupView.this.currColor = ((Integer) valueAnimator.getAnimatedValue()).intValue();
                    FullScreenPopupView.this.postInvalidate();
                }
            });
            ofObject.setDuration((long) getAnimationDuration()).start();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public PopupAnimator getPopupAnimator() {
        if (this.translateAnimator == null) {
            this.translateAnimator = new TranslateAnimator(getPopupContentView(), getAnimationDuration(), PopupAnimation.TranslateFromBottom);
        }
        return this.translateAnimator;
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void onDetachedFromWindow() {
        if (!(this.popupInfo == null || this.translateAnimator == null)) {
            getPopupContentView().setTranslationX(this.translateAnimator.startTranslationX);
            getPopupContentView().setTranslationY(this.translateAnimator.startTranslationY);
            this.translateAnimator.hasInit = true;
        }
        super.onDetachedFromWindow();
    }
}
